let color = [
    'rgba(113, 226, 135, 1)',
    'rgba(119, 247, 253, 1)',
    'rgba(44, 104, 231, 1)',
    'rgba(93, 202, 250, 1)'
]

export let option = {
    color: color,
    backgroundColor: '#000',
    tooltip: {
        trigger: 'item'
    },
    legend: {
        show: true,
        orient: 'vertical',
        top: '40%',
        right: '5%',
        icon: 'rect',
        itemGap: 20,
        itemWidth: 20,
        itemHeight: 10,
        color: '#fff',
        formatter: function (name: any) {},
        itemStyle: {
            borderWidth: 1
        },
        textStyle: {
            rich: {
                number: {
                    width: 0,
                    color: '#DDF6FD',
                    align: 'left',
                    fontSize: 16,
                    fontWeight: 'bold',
                    padding: [0, 0, 0, 0]
                },
                name: {
                    color: 'rgba(255,255,255,0.8)',
                    fontSize: 14,
                    fontWeight: 400,
                    fontFamily: 'Source Han Sans CN',
                    padding: [0, 0, 0, 4]
                },
                unit: {
                    color: 'rgba(255,255,255,0.8)',
                    fontSize: 12,
                    fontWeight: 400,
                    fontFamily: 'Source Han Sans CN',
                    padding: [0, 0, 0, 0]
                },
                percent: {
                    color: '#DDF6FD',
                    align: 'left',
                    fontSize: 16,
                    fontWeight: 'bold',
                    padding: [0, 0, 0, 0]
                }
            }
        }
    },
    title: [
        {
            text: '农产品不同渠道本周销售额',
            top: '5%',
            x: 'center',
            textStyle: {
                color: '#ffffff'
            }
        },
        {
            text: '',
            left: '20%',
            bottom: '37%',
            textStyle: {
                rich: {
                    num: {
                        fontSize: 18,
                        color: '#49F1F2',
                        fontFamily: 'DIN Alternate',
                        fontWeight: 'bold'
                    },
                    unit: {
                        color: '#fff',
                        fontSize: 14,
                        fontWeight: '400',
                        padding: [0, 0, -0, 0]
                    }
                }
            }
        }
    ],

    series: [
        {
            type: 'pie',
            radius: ['45%', '65%'],
            center: ['40%', '50%'],
            padAngle: 5,
            label: {
                show: false
            },
            top: '15%',
            right: '23%',
            itemStyle: {
                // shadowColor: 'rgba(255, 255, 255, 0.5)',
                // shadowBlur: 2,
                borderWidth: 5,
                borderColor: {
                    type: 'linear', // 使用线性渐变
                    x: 0,
                    y: 0,
                    x2: 1,
                    y2: 1,
                    colorStops: [
                        { offset: 0, color: 'rgba(7, 36, 66, 0.5)' }, // 起始颜色
                        { offset: 1, color: 'rgba(11, 57, 102, 1)' } // 结束颜色
                    ]
                },
                opacity: 1,
                color: function (params: any) {
                    // 为每个扇区设置不同的渐变色
                    const colorList = [
                        {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 1,
                            y2: 1,
                            colorStops: [
                                { offset: 0, color: 'rgba(255, 87, 51, 0)' }, // 起始颜色
                                { offset: 1, color: 'rgba(255, 87, 51, 1)' } // 结束颜色
                            ]
                        },
                        {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 1,
                            y2: 1,
                            colorStops: [
                                { offset: 0, color: 'rgba(17, 135, 145, 0)' }, // 起始颜色
                                { offset: 1, color: 'rgba(17, 135, 145, 1)' } // 结束颜色
                            ]
                        },
                        {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 1,
                            y2: 1,
                            colorStops: [
                                { offset: 0, color: 'rgba(24, 132, 236, 0)' }, // 起始颜色
                                { offset: 1, color: 'rgba(24, 132, 236, 1)' } // 结束颜色
                            ]
                        }
                    ]
                    return colorList[params.dataIndex % colorList.length] // 循环使用渐变色
                }
            },
            emphasis: {
                scale: false
            },
            data: []
        },

        {
            name: '黄线',
            type: 'pie',
            startAngle: 85,
            radius: ['35%', '38%'],
            center: ['40%', '50%'],
            hoverAnimation: false,
            top: '15%',
            right: '23%',
            // startAngle: 90,
            padAngle: 5,
            tooltip: {
                // show: false,
            },
            itemStyle: {
                borderCap: 'round',

                normal: {
                    color: function (data: any) {
                        let tempColor = data.data == 10 ? '#000000  ' : '#1884EC'
                        return tempColor
                    }
                }
            },
            zlevel: 4,
            labelLine: {
                show: false
            },
            data: [10, 50, 10, 50, 10, 50, 10, 50]
        }
    ]
}
